import * as vscode from 'vscode';

export class BaseLogger {
  protected outputChannel: vscode.LogOutputChannel;

  constructor(channelName: string) {
    this.outputChannel = vscode.window.createOutputChannel(channelName, { log: true });
  }

  info(message: string): void {
    this.outputChannel.info(message);
  }

  error(message: string): void {
    this.show();
    this.outputChannel.error(message);
  }

  append(message: string): void {
    this.outputChannel.appendLine(message);
  }

  warn(message: string): void {
    this.outputChannel.warn(message);
  }

  debug(message: string): void {
    this.outputChannel.debug(message);
  }

  errorWithStack(message: string): void {
    const error = new Error(message);
    this.show();
    this.outputChannel.error(`Error: ${message}`);
    this.outputChannel.error(`Stack trace: ${error.stack}`);
  }

  show(preserveFocus?: boolean): void {
    this.outputChannel.show(preserveFocus);
  }

  hide(): void {
    this.outputChannel.hide();
  }

  clear(): void {
    this.outputChannel.clear();
  }

  dispose(): void {
    this.outputChannel.dispose();
  }
} 